package net.oschina.app.factory;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import net.oschina.app.fragment.TweetNewFragment;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2017/1/14.
 * 动弹fragment工厂
 */

public class TweetFragmentFactory extends BaseFactory {

    @Override
    public Fragment getFragment(int position) {
        Map<Integer, Fragment> fragments = new HashMap<>();
        Fragment fragment = fragments.get(position);
        if (fragment == null) {
            switch (position) {
                case 0:
                    fragment = new TweetNewFragment();
                    Bundle news = new Bundle();
                    news.putString("uid","0");
                    fragment.setArguments(news);
                    break;
                case 1:
                    fragment = new TweetNewFragment();
                    Bundle hot = new Bundle();
                    hot.putString("uid","-1");
                    fragment.setArguments(hot);
                    break;
                case 2:
                    fragment = new TweetNewFragment();
                    Bundle my = new Bundle();
                    my.putString("uid","3226664");
                    fragment.setArguments(my);
                    break;
                default:
                    fragment = new TweetNewFragment();
            }
            fragments.put(position, fragment);
        }
        return fragment;
    }


}
